package org.mall.modules.order.controller.users;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.mall.common.api.vo.CommonResult;
import org.mall.modules.order.service.OrderCommentReplyService;
import org.mall.modules.pojo.order.bo.OrderCommentReplyCreateBO;
import org.mall.modules.pojo.order.bo.OrderCommentReplyPageBO;
import org.mall.modules.pojo.order.dto.OrderCommentReplyCreateDTO;
import org.mall.modules.pojo.order.dto.OrderCommentReplyPageDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

import static org.mall.common.api.vo.CommonResult.success;


/**
 *
 * 评论回复模块 Api(user)
 *
 * @author wtz
 * @time 2019-05-31 18:00
 */
@RestController
@RequestMapping("/user/orderCommentReply")
@Api("用户评论回复模块 ")
public class OrderCommentReplyController {

    @Autowired
    private OrderCommentReplyService orderCommentReplyService;

    @PostMapping("/createOrderComment_reply")
    //@RequiresLogin
    @ApiOperation(value = "创建订单回复")
    public CommonResult<OrderCommentReplyCreateBO> createOrderCommentReply(@RequestBody @Valid OrderCommentReplyCreateDTO orderCommentReplyCreateDTO){
        return success(orderCommentReplyService.createOrderCommentReply(orderCommentReplyCreateDTO));
    }

    @GetMapping("/orderCommentReplyPage")
    //@RequiresLogin
    @ApiOperation(value = "分页获取评论回复")
    public CommonResult<OrderCommentReplyPageBO> getOrderCommentReplyPage(@Valid OrderCommentReplyPageDTO orderCommentReplyCreateDTO){
        return success(orderCommentReplyService.getOrderCommentReplyPage(orderCommentReplyCreateDTO));
    }
}
